package com.qf.service.impl;

import com.qf.dao.DeveloperDao;
import com.qf.dao.ProjectDao;
import com.qf.pojo.Developer;
import com.qf.pojo.Project;
import com.qf.service.ProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 公用常量
 * @Data: 2022/9/2 15:16
 * @Pacakge: com.qf.service.impl
 * @ClassName: ProjectServiceImpl
 * @Author: fan
 */
@Service("projectService")
public class ProjectServiceImpl implements ProjectService {
    @Autowired
    private ProjectDao projectDao;
    @Autowired
    private DeveloperDao developerDao;
    @Override
    public List<Project> findAllProject() {
        List<Project> list = projectDao.findAllProject();
        for (Project project:list){
            List<Developer> developers = developerDao.selectDeveloperByDid(project.getDid());
            if (developers != null && developers.size() != 0){
                Developer developer = developers.get(0);
                project.setDeveloper(developer);
            }
        }
        return list;
    }
}
